import {lazy} from 'react'
import {
  AppOutline,
  MessageFill,
  UnorderedListOutline,
  UserOutline,
} from 'antd-mobile-icons'
import {Navigate} from 'react-router-dom'

let Home =lazy(()=>import('../page/home/Index'))
let Order =lazy(()=>import('../page/order/Index'))
let Message =lazy(()=>import('../page/message/Index'))
let My =lazy(()=>import('../page/my/Index'))
let Mylayout =lazy(()=>import('../page/mylayout/Index'))
let Login =lazy(()=>import('../page/login/Index'))
let List =lazy(()=>import('../page/list/Index'))

export const homeRoutes=[
    {
        path:'/home',
        element:<Home></Home>,
        title:"首页",
        icon:<AppOutline />,
    },
    {
        path:'/order',
        element:<Order></Order>,
        title:"订单",
        icon:<UnorderedListOutline />,
    },
    {
        path:'/message',
        element:<Message></Message>,
        title:"消息",
        icon:<MessageFill />
    },
    {
        path:'/my',
        element:<My></My>,
        title:"我的",
        icon:<UserOutline />,
    },
]

export const routes=[
    {
        path:'/',
        element:<Mylayout></Mylayout>,
        children:[
            ...homeRoutes,
            {
                path:'/',
                element:<Navigate to='/home'></Navigate>
            }
        ]
    },
    {
        path:'/login',
        element:<Login></Login>
    },
    {
        path:'/list',
        element:<List></List>
    },
]